package managerInterface;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.TileObserver;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;

public class tableComponent extends JPanel{
	private int height, width;
	private Color colorTitle;
	private String title, ID, name, numStudent, numTeacher;
	JLabel lblID, lblName, lblnumStudent, lblnumTeacher;
	
	public tableComponent(int height, int width, Color colorTitle,
			String title, String iD, String name, String numStudent,
			String numTeacher) {
		this.height = height;
		this.width = width;
		this.colorTitle = colorTitle;
		this.title = title;
		ID = iD;
		this.name = name;
		this.numStudent = numStudent;
		this.numTeacher = numTeacher;		
	}
	
	public JPanel getComponentPanel() throws Exception{
		UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		JPanel panelComponent = new JPanel();
		JPanel panelTitle = new JPanel();
		JLabel labelTitle = new JLabel(title);
		JPanel panelBorder = new JPanel();
		lblID = new JLabel("  ID                     " + ID);
		lblName = new JLabel("  Tên                  " +name);
		lblnumStudent = new JLabel("  Số sinh viên  " +numStudent);
		lblnumTeacher = new JLabel("  Số giảng viên " +numTeacher);
		
		labelTitle.setPreferredSize(new Dimension(width - 20, 30));
		labelTitle.setBackground(colorTitle);
		labelTitle.setOpaque(true);		
		panelBorder.setPreferredSize(new Dimension(width, height - 20));
		panelTitle.setPreferredSize(new Dimension(width - 20, 30));
		panelComponent.setPreferredSize(new Dimension(width, height));
		
		panelBorder.setBorder(BorderFactory.createLineBorder(Color.lightGray));

		panelTitle.add(labelTitle);
		panelBorder.setLayout(new GridLayout(5, 1));
		panelBorder.add(panelTitle);
		panelBorder.add(lblID);
		panelBorder.add(lblName);
		panelBorder.add(lblnumStudent);
		panelBorder.add(lblnumTeacher);
		panelComponent.setBorder(BorderFactory.createLineBorder(Color.red));
		panelComponent.add(panelBorder);
		
		return panelComponent;
	}
	

	public tableComponent() {
		
	}


}
